<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Extending the CSS parser: GTK+ 3 Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
<link rel="home" href="index.html" title="GTK+ 3 Reference Manual">
<link rel="up" href="gtk-migrating-GtkStyleContext.html" title="Theming changes">
<link rel="prev" href="gtk-migrating-theme-GtkStyleContext-engines.html" title="Migrating theme engines">
<link rel="next" href="gtk-migrating-GtkStyleContext-css.html" title="Using the CSS file format">
<meta name="generator" content="GTK-Doc V1.33.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts"></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="gtk-migrating-GtkStyleContext.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="gtk-migrating-theme-GtkStyleContext-engines.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="gtk-migrating-GtkStyleContext-css.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="gtk-migrating-GtkStyleContext-parser-extensions"></a>Extending the CSS parser</h2></div></div></div>
<p>
      In <a class="link" href="GtkStyle.html" title="GtkStyle"><span class="type">GtkStyle</span></a>-based engines, GtkRCStyle provided ways to extend the
      gtkrc parser with engine-specific extensions. This has been replaced
      by <a class="link" href="GtkThemingEngine.html#gtk-theming-engine-register-property" title="gtk_theming_engine_register_property ()"><code class="function">gtk_theming_engine_register_property()</code></a>, which lets a theme engine
      register new properties with an arbitrary type. While there is built-in
      support for most basic types, it is possible to use a custom parser
      for the property.
    </p>
<p>
      The installed properties depend on the <a class="link" href="GtkThemingEngine.html#GtkThemingEngine--name" title="The “name” property"><span class="type">“name”</span></a> property,
      so they should be added in the <code class="literal"><code class="function">constructed()</code></code> vfunc.
      For example, if an engine with the name "Clearlooks" installs a
      "focus-color" property with the type <span class="type">GdkRGBA</span>, the property
      <code class="literal">-Clearlooks-focus-color</code> will be registered and
      accepted in CSS like this:
      </p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="n">GtkEntry</span> <span class="p">{</span>
  <span class="o">-</span><span class="n">Clearlooks</span><span class="o">-</span><span class="n">focus</span><span class="o">-</span><span class="nl">color</span><span class="p">:</span> <span class="n">rgba</span><span class="p">(</span><span class="mi">255</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mf">1.0</span><span class="p">);</span>
<span class="p">}</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p>
    </p>
<p>
      Widget style properties also follow a similar syntax, with the widget
      type name used as a prefix. For example, the <a class="link" href="GtkWidget.html" title="GtkWidget"><span class="type">GtkWidget</span></a> focus-line-width
      style property can be modified in CSS as
      <code class="literal">-GtkWidget-focus-line-width</code>.
    </p>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.33.1</div>
</body>
</html>